<template>
  <common :show-search="false" title="二级标">
    <div class="seachTag">
      <egrid
        border
        :data='tableData'
        :columns='columns'
      ></egrid>
    </div>
  </common>
</template>
<script>
import Common from './common';
let priceCell = {
  template: `<div :style="[greedColor]">{{this.row.mkPrice}}</div>`,
  props: ['row'],
  data: function () {
    return {
      redColor: {
        color: '#e63453'
      },
      greedColor: {
        color: '#00c977'
      }
    };
  }
};
let updownCell = {
  template: `<div :style="[greedColor]">{{this.row.upsAndDowns}}</div>`,
  props: ['row'],
  data: function () {
    return {
      redColor: {
        color: '#e63453'
      },
      greedColor: {
        color: '#00c977'
      }
    };
  }
};
let rateCell = {
  template: `<div :style="[greedColor]">{{this.row.rate}}</div>`,
  props: ['row'],
  data: function () {
    return {
      redColor: {
        color: '#e63453'
      },
      greedColor: {
        color: '#00c977'
      }
    };
  }
};
let cccfCell = {
  template: `<div :style="[greedColor]">{{this.row.CCCF}}</div>`,
  props: ['row'],
  data: function () {
    return {
      redColor: {
        color: '#e63453'
      },
      greedColor: {
        color: '#00c977'
      }
    };
  }
};
export default {
  data() {
    return {
      columns: [
        {
          label: '项目编号',
          prop: 'marketNo',
          minWidth: 90
        },
        {
          label: '产品',
          prop: 'product', // 主产品名  mainProductName
          minWidth: 90
        },
        {
          label: '二级标',
          prop: 'standard',   // mainStandard 主标准 标准国家 mainStandardCountry
          minWidth: 90
        },
        {
          label: '市价',
          // prop: 'marketPrice',
          minWidth: 90,
          component: priceCell
        },
        {
          label: '涨跌',
          // prop: 'adRatio', 涨跌颜色 adRatioColor
          minWidth: 90,
          component: updownCell
        },
        {
          label: '建议折率',
          // prop: 'discountRate',
          minWidth: 90,
          component: rateCell
        },
        {
          label: '流通系数',
          prop: 'CCCF', // flowCoefficient
          minWidth: 90,
          component: cccfCell
        }
      ],
      tableData: [
        {
          marketNo: '2016-05-02',
          product: '王小虎',
          standard: 'cddds',
          mkPrice: '12',
          upsAndDowns: '-1233',
          rate: '10%',
          CCCF: '0.5%'
        }
      ]
    };
  },
  beforeMount () {
    this.requestTagList();
  },
  methods: {
    requestTagList () {
      let data = {
        mainLevelCode: '',
        mainProductName: '',
        title: ''
      };
      this.reqSecTagData(data);
    },
    reqSecTagData (data) {
      this.ajax({
        type: 'POST',
        url: 'malisk/client/market/subStandardList',
        data: data,
        success: res => {
          setTimeout(() => {
            this.$pcNProgress.done();
          }, 300);
          if (res.code === 200) {
            // this.$store.dispatch(' ', res.result);
            console.log('secondTag', res.result);
          } else {
            this.errorTip(res.message);
          }
        }
      });
    }
  },
  components: {
    Common
  }
};
</script>
<style lang="less" rel="stylesheet/less" scoped>
  .seachTag{
    width: 1070px;
    height: 376px;
  }
</style>